extern crate rre;
use rre::*;
    #[test]
    fn test_match_string() {
        let s = String::from("ab+");
        let mut re = s.chars();
        let reg =  compile_all( parse_regex(&mut re).expect("parsing error"));
        let ret =  match_string(&reg,&String::from("beeeeeeeeeedddd"),0);
        assert_eq!(ret, None);
    }

    #[test]
    fn test_match_string_all() {
        let s = String::from("(a|b)+c+");
        let mut re = s.chars();
        let reg =  compile_all( parse_regex(&mut re).expect("parsing error"));
        let ret =  match_string_all(&reg,&String::from("ac12bcccc"));
        assert_eq!(ret, Some(vec![MatchResult{start:0,end:2},MatchResult{start:4,end:9}]));
    }
    #[test]
    fn test_match_digit() {
        let s = String::from("ab\\d+");
        let mut re = s.chars();
        let reg =  compile_all( parse_regex(&mut re).expect("parsing error"));
        let ret =  match_string_all(&reg,&String::from("aaaab12432kd"));
        assert_eq!(ret, Some(vec![MatchResult{start:3,end:10}]));

    #[test]
    fn test_match_any() {
        let s = String::from("(a|b)+.");
        let mut re = s.chars();
        let reg =  compile_all( parse_regex(&mut re).expect("parsing error"));
        let ret =  match_string_all(&reg,&String::from("acddddd"));
        assert_eq!(ret, Some(vec![MatchResult{start:0,end:2}]));
    }
